class slurm::service inherits slurm{

  case $operatingsystemmajrelease {
  '6': {
    $service_name = "slurm"
    }
  /7|8|9/: {
    $service_name = "slurmd"
    }
  }
  if $enable_service {
    service { "munge":
      ensure      => running,
      hasstatus   => true,
      hasrestart  => true,
      enable      => true,
    }->
    service { $service_name:
      ensure      => running,
      hasstatus   => true,
      hasrestart  => true,
      enable      => true,
    }
  }
  #else {
  #  service { "munge":
  #    ensure      => stopped,
  #    hasstatus   => true,
  #    hasrestart  => true,
  #    enable      => false,
  #    before      => Service['slurm'],
  #  }
  #  service { "slurm":
  #    ensure      => stopped,
  #    hasstatus   => true,
  #    hasrestart  => true,
  #    enable      => false,
  #  }
  #}
}
